Skip to main content
Version: 1.0.16

DROP OPERATOR CLASS

DROP OPERATOR CLASS — remove an operator class

Synopsis

DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]

Description

DROP OPERATOR CLASS drops an existing operator class. To execute this command, you must be the owner of the operator class.

DROP OPERATOR CLASS will not delete any operators or functions referenced by the class. If there are indexes that depend on the operator class, you will need to specify CASCADE to complete the removal.

Parameters

IF EXISTS

Do not throw an error if the operator class does not exist. A notice is issued in this case.

name

The name of an existing operator class (optionally schema-qualified).

index_method

The name of the index access method the operator class is for.

CASCADE

Automatically drop objects that depend on the operator class (such as indexes), and in turn all objects that depend on those objects.

RESTRICT

Refuse to drop the operator class if any objects depend on it. This is the default.

Notes

DROP OPERATOR CLASS will not drop the operator family containing the class, even if there are no remaining members in the family (in particular, the family implicitly created by CREATE OPERATOR CLASS). An empty operator family is harmless, but for the sake of cleanliness you may wish to remove the family using DROP OPERATOR FAMILY, or it may be better to use DROP OPERATOR FAMILY from the start.

Examples

Remove the B-tree operator class widget_ops:

DROP OPERATOR CLASS widget_ops USING btree;

This command will not succeed if there are any existing indexes that use the operator class. Add CASCADE to drop such indexes along with the operator class.

See Also

ALTER OPERATOR CLASS, CREATE OPERATOR CLASS, DROP OPERATOR FAMILY